PreviousNextTracker indexSee it online !

(224/308) 1699 - xsearch find all in selection via beanshell

xsearch.SearchAndReplace.find(view, view.getBuffer(), 0, view.getBuffer().getLength(), false, false, false); doesnt work as expected... I cant get this to work in the dialog either..

looking at http://www.javadocexamples.com/java_source/xsearch/SearchAndReplace.java.html .. kind of messy

I want to select a range, and find all instances of something, highlighting them... "Refactoring" tools...

heres a cut:

String word = null;
int start = 0;
int end = 0;
Boolean contrainSelected = false;
if(textArea.getSelectedLines().length() > 1 ){
Selection\[\] sel = textArea.getSelection();
start = sel\[0\].getStart();
end = sel\[0\].getEnd();
word = Macros.input(view, "Find all in selection:", word);
contrainSelected = true;
}
else if(textArea.getSelectedText() == null){
textArea.selectWord();
word= textArea.getSelectedText();
}
else {
word = textArea.getSelectedText();
}

textArea.selectNone();
// assignSelectionToSearchString(JEditTextArea textArea, 920: boolean selectWord)
xsearch.SearchSettings.push();
xsearch.SearchSettings.resetSettings();
xsearch.SearchAndReplace.setSearchString(word);
xsearch.SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
xsearch.SearchAndReplace.setFindAll(true);

if(contrainSelected){
xsearch.SearchAndReplace.find(view, view.getBuffer(), start, end, false, false, false);
}
else {
xsearch.SearchAndReplace.find(view);
}
xsearch.SearchSettings.pop();

Submitted *anonymous - 2013-02-24 21:06:26 Assigned
Priority 5 Labels
Status open Group None
Resolution None

Comments